<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<title>多边形</title>
	<style type="text/css">
		canvas{
			margin-top: 100px;
			border:1px solid red;
		}
	</style>
</head>
<body>
<canvas width="500" height="500" id="can">您的浏览器版本太低，不支持画布，请升级您的浏览器</canvas>
<script type="text/javascript">
	// 获取画布
	var can=document.getElementById("can");
	// 获取画笔
	var pen=can.getContext("2d");

	 pen.beginPath();
	pen.moveTo(100,10);
	 pen.lineTo(160,10);
	 pen.lineTo(190,70);
	 pen.lineTo(160,130);
	 pen.lineTo(100,130);
	 pen.lineTo(73,70);
	 pen.closePath();
	 pen.lineWidth="10";
	 pen.strokeStyle="green";
	pen.stroke();



</script>





</body>
</html>